from django.shortcuts import render

# Create your views here.
import os
from dashscope import Generation
from rest_framework.views import APIView


# def get_response(messages_s):
#     response = Generation.call(
#         # 若没有配置环境变量，请用百炼API Key将下行替换为：api_key="sk-xxx",
#         api_key=os.getenv("DASHSCOPE_API_KEY"),
#         model="qwen-plus",
#         messages=messages_s,
#         result_format="message",
#     )
#     return response
#
#
# messages = [
#     {
#         "role": "system",
#         "content": """你是一名万能助手""",
#     }
# ]
#
# open1 = True
# while open1:
#     user_input = input("请输入：")
#     if user_input == '退出':
#         open1 = False
#         break
#     messages.append({"role": "user", "content": user_input})
#     assistant_output = get_response(messages).output.choices[0].message.content
#     # 将大模型的回复信息添加到messages列表中
#     messages.append({"role": "assistant", "content": assistant_output})
#     print(f"模型输出：{assistant_output}")
#     print("\n")




